/* eslint-disable camelcase */

// 请求参数类型
export interface GetBotOnlineInfoParams {
  bot_id: string; // 必填的智能体ID
}

// 响应数据结构类型定义
export interface BotOnlineInfo {
  bot_id: string;
  name: string;
  description: string;
  icon_url: string;
  create_time: number;
  update_time: number;
  version: string;
  prompt_info: {
    prompt: string;
  };
  onboarding_info: {
    prologue: string;
    suggested_questions: string[];
  };
  bot_mode: number;
  model_info: {
    model_id: string;
    model_name: string;
    temperature: number;
    top_p: number;
    frequency_penalty: number;
    presence_penalty: number;
    context_round: number;
    max_tokens: number;
  };
  plugin_info_list: PluginInfo[];
  workflow_info_list: WorkflowInfo[];
  shortcut_commands: ShortcutCommand[];
}

export interface PluginInfo {
  plugin_id: string;
  name: string;
  description: string;
  icon_url: string;
  api_info_list: ApiInfo[];
}

export interface ApiInfo {
  api_id: string;
  name: string;
  description: string;
}

export interface WorkflowInfo {
  id: string;
  name: string;
  description: string;
  icon_url: string;
}

export interface ShortcutCommand {
  id: string;
  name: string;
  command: string;
  description: string;
  query_template: string;
  icon_url: string;
  components: Component[];
  tool: {
    name: string;
    type: string;
  };
}

export interface Component {
  name: string;
  description: string;
  type: string;
  tool_parameter: string;
  default_value: string;
  is_hide: boolean;
}

// 定义消息对象类型
export interface EnterMessage {
  role: string; // 消息角色（如 user/assistant）
  content: string; // 消息内容
  // 根据实际文档补充其他可能的字段
}

// 创建会话请求参数类型
// OAuth 授权（多人协作场景）
export interface CreateConversationParams {
  messages?: EnterMessage[]; // 可选，初始消息列表
  meta_data?: Record<string, any>; // 可选，元数据键值对
}

// 创建会话响应类型
export interface CreateConversationResponse {
  code: number;
  msg: string;
  data: {
    conversation_id: string; // 会话ID
    created_time: number; // 创建时间戳
    // 根据实际返回数据结构补充其他字段
  };
}

// 历史消息类型
export interface HistoryMessage {
  id: string;
  conversation_id: string;
  inputs: Record<string, any>;
  query: string;
  answer: string;
  message_files: MessageFile[];
  feedback: Feedback | null;
  retriever_resources: RetrieverResource[];
  created_at: number;
}

interface MessageFile {
  id: string;
  type: string;
  url: string;
  belongs_to: string;
}

interface Feedback {
  rating: string;
}

interface RetrieverResource {
  position: number;
  dataset_id: string;
  dataset_name: string;
  document_id: string;
  document_name: string;
  segment_id: string;
  score: number;
  content: string;
}

// 会话列表类型
export interface Conversation {
  id: string;
  name: string;
  inputs: Record<string, any>;
  status: string;
  introduction: string;
  created_at: number;
  updated_at: number;
}
